<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图书管理</title>

<link rel="stylesheet" href="/static/css/style.css">

</head>
<body>
	<div id="header">
			<img class="logo_img" alt="" src="/static/img/logo.gif" >
			<span class="wel_word">图书管理系统</span>
			<div>
				<a href="/getBooks">图书管理</a>
				<a href="/ordersManager">订单管理</a>
				<a href="/main">返回商城</a>
			</div>
	</div>
	
	<div id="main">
		<table>
		
		
					<tr>
						<td>名称</td>
						<td>价格</td>
						<td>作者</td>
						<td>销量</td>
						<td>库存</td>
						<td colspan="2">操作</td>
					</tr>	
					{{range .Books}}
						<tr>
							<td>{{.Title}}</td>
							<td>{{.Price}}</td>
							<td>{{.Author}}</td>
							<td>{{.Sales}}</td>
							<td>{{.Stock}}</td>
							<td><a href="/toUpdateBook?id={{.Id}}">修改</a></td>
							<td><a id="{{.Title}}" class="delA" href="/delBook?id={{.Id}}">删除</a></td>
						</tr>
					{{end}}
			
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><a href="/toUpdateBook">添加图书</a></td>
			</tr>	
		</table>
		<div id="page_nav">
			
			{{if .IsHasPrev}}
			<a href="/getBooks?pageNo=1">首页</a>
			<a href="/getBooks?pageNo={{.GetPrevPage}}">上一页</a>
			{{end}}
			
						当前第{{.PageNo}}页
						共{{.PageCount}}页，{{.RecordCount}}条记录
			{{if .IsHasNext}}	
			<a href="/getBooks?pageNo={{.GetNextPage}}">下一页</a>
			<a href="/getBooks?pageNo={{.PageCount}}">末页</a>
			{{end}}
			 到第<input value="" name="pn" id="pn_input"/>页
			<input id="pn_btn" type="button" value="确定">
			
		</div>
		
		
	</div>
	
	<div id="bottom">
		<span>
			尚硅谷书城.Copyright &copy;2015
		</span>
	</div>
</body>
<script src="/static/script/jquery-1.7.2.js"></script>
<script type="text/javascript">
	$(function(){
		$(".delA").click(function(){
			var title=$(this).attr("id")
			return confirm("你确定要删除《"+title+"》这本书吗")
		})

		$("#pn_btn").click(function(){
			var page = $("#pn_input").val()
			window.location="/getBooks?pageNo="+page
		})
	})

	

</script>
</html>